package DesignPatterns;

public class Factory {
    Food getFood(String food){
        if (food.equals("chinese")){
            return new ChinseFood();
        }else if (food.equals("amaria")){
            return new AmairaFood();
        }else {
            return null;
        }
    }
}
interface Food{

}
class ChinseFood implements Food{
    ChinseFood(){
        System.out.println("中餐！");
    }
}
class AmairaFood implements Food{
    AmairaFood(){
        System.out.println("西餐！");
    }
}
class Test{
    public static void main(String[] args) {
        Food chinese = new Factory().getFood("chinese");
    }
}